layui.use(['laydate','table'], function() {
    var laydate = layui.laydate;
    var table = layui.table;
    var $ = layui.jquery;
    <!--运营首页导航-->
    $('#refresh').click(function(){
        location.reload();
    });
    $('#button_id2').click(function(){
        //返回上一页并刷新：
        window.location.href = document.referrer;
    });
    $('#SyCourseOrderManagementselControllerAllOrders').click(function(){
        $.ajax({
            url:'/SyOperationController/AllOrderReviewList',
            type:'post',
            data:"",
            success:function(data){
                getTable(data.data)
            }
        })
    });
    $('#SyCourseOrderManagementselControllerPendingPayment').click(function(){
        $.ajax({
            url:'/SyOperationController/PendingPaymentList',
            type:'post',
            data:"",
            success:function(data){
                getTable(data.data)
            }
        })
    });
    $('#SyCourseOrderManagementselControllerCompleted').click(function(){

        $.ajax({
            url:'/SyOperationController/CompletedList',
            type:'post',
            data:"",
            success:function(data){
                getTable(data.data)
            }
        })
    });
    $('#SyCourseOrderManagementselControllerCancelled').click(function(){
        $.ajax({
            url:'/SyOperationController/llerCanceledList',
            type:'post',
            data:"",
            success:function(data){
                getTable(data.data)
            }
        })
    });
    $.ajax({
        url:'/SyOperationController/ControllerAllOrders',
        type:'post',
        data:"",
        success:function(data){
            $("#td_id2").html("全部订单"+"("+data.data+")");
        }
    })
    $.ajax({
        url:'/SyOperationController/SyCoursePendingPayment',
        type:'post',
        data:"",
        success:function(data){
            $("#td_id3").html("待付款"+"("+data.data+")");
        }
    })
    $.ajax({
        url:'/SyOperationController/OrderCompleted',
        type:'post',
        data:"",
        success:function(data){
            $("#td_id4").html("已完成"+"("+data.data+")");
        }
    })
    $.ajax({
        url:'/SyOperationController/SyConCancelled',
        type:'post',
        data:"",
        success:function(data){
            $("#td_id5").html("已取消"+"("+data.data+")");
        }
    })
    $.ajax({
        url:'/SyOperationController/SyConCancelled',
        type:'post',
        data:"",
        success:function(data){
            $("#td_id5").html("已取消"+"("+data.data+")");
        }
    })
    function getTable(data) {
        table.render({
            elem: "#table_id",//容器
            data: data,
            title: "用户信息表",//标题
            limit: 3,//分页显示条
            width: 1150,//宽
            page: {//自定义分页 count总记录 prev上一页 next下一页 refresh刷新 skip表格各种外观，尺寸
                layout: ['count', 'prev', 'page', 'next', 'skip', 'refresh', 'limit'],
                limits: [3, 6, 9, 12, 15],//分页选项
                first: "第一页",
                last: "最后一页",
            },
            cols: [[//定义列
                {
                    field: 'orderNo',
                    title: '订单编号',
                    width: 150
                },
                {
                    field: 'createDate',
                    title: '提交时间',
                    width: 150
                },
                {
                    field: 'userNumber',
                    title: '用户账号',
                    width: 120
                },
                {
                    field: 'logisticsFee',
                    title: '订单金额',
                    width: 120
                },
                {
                    field: 'orderPaymentChannel',
                    title: '支付方式',
                    width: 120
                },
                {
                    field: 'orderSource',
                    title: '订单来源',
                    width: 120
                },
                {
                    field: 'orderStatus',
                    title: '订单状态',
                    width: 120
                },
                {
                    field: 'orderType',
                    title: '类型',
                    width: 120
                },
                {
                    title: '操作',
                    width: 150,
                    templet: function (d) {
                        return "<a style='color: green;margin-left: 40px' onclick='getChKan(" + d.courseId + ")'>查看订单</a>"
                    }
                }]]


        })
    }
    $.ajax({
        url:'/SyOperationController/AllOrderReviewList',
        type:'post',
        data:"",
        success:function(data){
            getTable(data.data)
        }
    })
    laydate.render({
        elem: '#name4',
        type: 'datetime',
        trigger: 'click'
    })
    selProduct=function () {
      var OrderNumber=$("#dindangbianhaoId").val();
      var UserAccount=$("#yonghuizhanghaoId").val();
      var PaymentMethod;
      if($("#PaymentMethod").val()=="微信支付"){
          PaymentMethod=2
      }else if($("#PaymentMethod").val()=="余额支付"){
          PaymentMethod=3
      }
      var SubmissionTimeId=$("#name4").val();
        $.ajax({
            url: '/SyOperationController/AllCourseOrderListView ',
            type: 'post',
            data:{"trueName":OrderNumber,"sex":UserAccount,"email":PaymentMethod,"remark":SubmissionTimeId},
            success: function (data) {
                getTable(data.data)
            }
        })
    }
    retrieve=function () {
        layer.open({
            type:2,  //弹出层类型
            title:"高级检索",
            area:['750px','410px'], //弹出层大小
            shade:0.4, //设置遮罩透明度
            offset:'auto', //设置遮罩位置
            content:'AdvancedSearchForOrderPayment.html', //弹出层内容页面
            success:function(layero,index){
            }
        });
        window.layer_1=layer;
    }

})

